export function sendNotification(msg: string, img: string) {
  const isPhone = /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
    navigator.userAgent
  )
  if (!isPhone) {
    if (!("Notification" in window)) {
      alert("此浏览器不支持桌面通知");
    } else if (Notification.permission === "granted") {
      // 让设备震动
      window.navigator.vibrate(200)
      const notification = new Notification("新消息", { body: msg, icon: img })
      // …
    } else if (Notification.permission !== "denied") {
      Notification.requestPermission().then((permission) => {
        // 如果用户同意，让我们创建一个通知
        if (permission === "granted") {
          // 让设备震动
          window.navigator.vibrate(200)
          const notification = new Notification("新消息", { body: msg, icon: img })
          // …
        }
      });
    }
  }
}